package com.ht.base.system.biz.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ht.base.system.common.pojo.qto.SysDictTypeQTO;
import com.ht.base.system.dao.dao.SysDictTypeDao;
import com.ht.base.system.dao.domain.SysDictTypeDO;
import org.base.common.appexception.AppException;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author hdengxian
 * @Date 2023/5/24 16:31
 */
@Component
public class SysDictTypeMapper extends ServiceImpl<SysDictTypeDao, SysDictTypeDO> {
    @Resource
    private SysDictTypeDao sysDictTypeDao;

    public Integer countByDictType(String dictType) throws AppException {
        LambdaQueryWrapper<SysDictTypeDO> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(SysDictTypeDO::getDictType, dictType);
        Integer count = sysDictTypeDao.selectCount(wrapper);
        if (count == null) {
            count = 0;
        }
        return count;
    }

    public List<SysDictTypeDO> findByCondition(SysDictTypeDO record) {
        return sysDictTypeDao.findByCondition(record);
    }

    public Integer countByCondition(SysDictTypeDO record) {
        return sysDictTypeDao.countByCondition(record);
    }

    public List<SysDictTypeDO> findSysDictTypeList(SysDictTypeQTO qto) {
        return sysDictTypeDao.findSysDictTypeList(qto);
    }

    public Integer findForPageCount(SysDictTypeQTO qto) {
        return sysDictTypeDao.findForPageCount(qto);
    }

    public List<SysDictTypeDO> findForPage(SysDictTypeQTO qto) {
        return sysDictTypeDao.findForPage(qto);
    }

}
